<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:a4j="http://richfaces.org/a4j"
                xmlns:rich="http://richfaces.org/rich">
    <style type="text/css">
        .inputstype{
            width: 120px !important;
        }
    </style>
    <h:form id ="emp">
        <rich:panel header="支付文件生成" styleClass="content-hight" >
            <rich:tabPanel>
                <rich:tab  header="查询条件" style="text-align:left;">

                    <h:panelGrid columns="2">
                        <h:outputLabel value="部   门: " />
                        <a4j:commandLink id="usern" onclick="#{rich:component('panel')}.show();">打开部门列表</a4j:commandLink>

                        <h:outputLabel value="单据种类: "/>
                        <h:selectManyCheckbox value="#{payfile.voutypes}">
                            <f:selectItem itemValue="3" itemLabel="借款单"/>
                            <f:selectItem itemValue="0" itemLabel="报销单"/>
                            <f:selectItem itemValue="1" itemLabel="差旅费报销单"/>
                            <f:selectItem itemValue="4" itemLabel="付款申请单"/>
                            <f:selectItem itemValue="5" itemLabel="支出证明单"/>
                            <f:selectItem itemValue="6" itemLabel="出国差旅费报销单"/>
                        </h:selectManyCheckbox>
                    </h:panelGrid>
                    <h:outputText value="单据日期:"/>
                    <h:panelGroup>
                        <rich:calendar value="#{payfile.qlb.numDateStart}"
                                       locale="zh_CN"
                                       popup="true"
                                       datePattern="yyyy-MM-dd"
                                       showApplyButton="false" inputClass="inputstype" />
                        至
                        <rich:calendar value="#{payfile.qlb.numDateEnd}"
                                       locale="zh_CN"
                                       popup="true"
                                       datePattern="yyyy-MM-dd"
                                       showApplyButton="false" inputClass="inputstype"/>
                    </h:panelGroup><br/>
                    <h:outputLabel value="核定金额:" />
                    <h:panelGroup>
                        <h:inputText size="20" id="checkaccountStart" value="#{payfile.qlb.checkaccountStart}"/>
                        -<h:inputText size="20" id="checkaccountEnd" value="#{payfile.qlb.checkaccountEnd}"/>
                    </h:panelGroup>
                    <br/>                    
                    <h:selectBooleanCheckbox value="#{payfile.qlb.cashPay}">
                        <a4j:ajax execute="@this" render="@none"/>
                    </h:selectBooleanCheckbox>
                    现金业务
                    <br/>
                    报销人:<h:inputText value="#{payfile.qlb.perName}"/>                   
                </rich:tab>
            </rich:tabPanel>


            <h:commandButton value="查询" action="#{payfile.refresh}"/>
            <h:commandButton value="生成" action="#{payfile.GenerateForConfirm}"/>

            <rich:messages globalOnly="true"/>
            <div style="width:100%;overflow:auto">
                <rich:dataTable id="editTable" value="#{payfile.payfilelist}" var="pflist"
                                rows="15"  style=" width: 1200px;"
                                noDataLabel="无数据"
                                rendered="#{payfile.payfilelist != null}">
                    <h:column>
                        <f:facet name="header">选择</f:facet>
                        <h:selectBooleanCheckbox value="#{pflist.selected}">
                            <a4j:ajax event="click" render="@this" execute="@this"/>
                        </h:selectBooleanCheckbox>
                    </h:column>

                    <h:column>
                        <f:facet name="header">
                            <h:panelGroup>
                                <h:outputText value="单据编号"/>
                            </h:panelGroup>
                        </f:facet>
                        <h:outputText value="#{pflist.number}"/>
                    </h:column>
                    <h:column>
                        <f:facet name="header">
                            <h:panelGroup>
                                <h:outputText value="单据种类"/>
                            </h:panelGroup>
                        </f:facet>
                        <h:outputText value="报销单"  rendered="#{pflist.voutype == '0'}" style="color:red"/>
                        <h:outputText value="差旅费报销单"  rendered="#{pflist.voutype == '1'}" style="color:blue"/>
                        <h:outputText value="借款单"  rendered="#{pflist.voutype == '3'}" style="color:green"/>
                        <h:outputText value="付款申请单"  rendered="#{pflist.voutype == '4'}" style="color:black"/>
                        <h:outputText value="支出证明单"  rendered="#{pflist.voutype == '5'}" style="color:#ffcf4c"/>
                        <h:outputText value="出国差旅费报销单"  rendered="#{pflist.voutype == '6'}" style="color:black"/>
                    </h:column>

                    <h:column>
                        <f:facet name="header">
                            <h:panelGroup>
                                <h:outputText value="单据日期"/>
                            </h:panelGroup>
                        </f:facet>
                        <h:outputText value="#{pflist.numDate}">
                            <f:convertDateTime pattern="yyyy年MM月dd日" timeZone="GMT+8" locale="cn" />
                        </h:outputText>
                    </h:column>
                    <h:column>
                        <f:facet name="header" >单据状态</f:facet>
                        <h:outputText value="等待审核"  rendered="#{pflist.numberStatus == '0'}" style="color:green"/>
                        <h:outputText value="未提交"  rendered="#{pflist.numberStatus == '1'}" style="color:red"/>
                        <h:outputText value="审核通过"  rendered="#{pflist.numberStatus == '2'}" style="color:green"/>
                        <h:outputText value="退回修改"  rendered="#{pflist.numberStatus == '3'}" style="color:red"/>
                        <h:outputText value="确认支付"  rendered="#{pflist.numberStatus == '4'}" style="color:blue"/>
                    </h:column>
                    <h:column>
                        <f:facet name="header">
                            <h:panelGroup>
                                <h:outputText value="部门"/>
                            </h:panelGroup>
                        </f:facet>
                        <h:outputText value="#{pflist.dept.name}"/>
                    </h:column>
                    <h:column>
                        <f:facet name="header">
                            <h:panelGroup>
                                <h:outputText value="人员姓名"/>
                            </h:panelGroup>
                        </f:facet>
                        <h:outputText value="#{pflist.user.cpsn_name}"/>
                    </h:column>

                    <h:column>
                        <f:facet name="header"  >金额</f:facet>
                        <h:outputText value="#{pflist.total}" >
                            <f:convertNumber type="number" pattern="#,##0.00"/>
                        </h:outputText>
                    </h:column>



                    <h:column>
                        <f:facet name="header">审核日期</f:facet>
                        <h:outputText value="#{pflist.auditDate}">
                            <f:convertDateTime pattern="yyyy年MM月dd日" timeZone="GMT+8" locale="cn" />
                        </h:outputText>
                    </h:column> 

                    <h:column>
                        <f:facet name="header">
                            <h:panelGroup>
                                <h:outputText value="审核人"/>
                            </h:panelGroup>
                        </f:facet>
                        <h:outputText value="#{pflist.auditor}"/>
                    </h:column>

                    <h:column>
                        <f:facet name="header">
                            <h:panelGroup>
                                <h:outputText value="核定金额"/>
                            </h:panelGroup>
                        </f:facet>
                        <h:outputText value="#{pflist.checkaccount}">
                            <f:convertNumber type="number" pattern="#,##0.00"/>
                        </h:outputText>
                    </h:column>

                    <h:column>
                        <f:facet name="header">
                            <h:panelGroup>
                                <h:outputText value="还款金额"/>
                            </h:panelGroup>
                        </f:facet>
                        <h:outputText value="#{pflist.repayment}">
                            <f:convertNumber type="number" pattern="#,##0.00"/>
                        </h:outputText>
                    </h:column>

                    <h:column>
                        <f:facet name="header">
                            <h:panelGroup>
                                <h:outputText value="待支付金额"/>
                            </h:panelGroup>
                        </f:facet>
                        <h:outputText value="#{pflist.remain}"/>
                    </h:column>

                    <f:facet name="footer">
                        <rich:dataScroller id="ds"></rich:dataScroller>
                    </f:facet>
                </rich:dataTable>
            </div>
        </rich:panel>

    </h:form>
    <rich:popupPanel id="panel" autosized="true">
        <f:facet name="header">部门列表</f:facet>
        <f:facet name="controls">
            <h:outputLink value="#" onclick="#{rich:component('panel')}.hide();">关闭</h:outputLink>
        </f:facet>
        <h:form>
            <rich:panel>
                <a4j:commandButton id="combhidelink" value="确定"
                                   onclick="#{rich:component('panel')}.hide();" render="usern,editTable" />
                <div style="height:260px; width: 300px;overflow:auto;">
                    <rich:dataTable id="editTablea" value="#{payfile.deptlist}" var="pro"
                                    onrowmouseover="this.style.backgroundColor='#F1F1F1'"
                                    onrowmouseout="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'"
                                    style=" width: 280px;">
                        <rich:column>
                            <f:facet name="header">选择</f:facet>
                            <h:selectBooleanCheckbox  value="#{pro.selected}"/>
                        </rich:column>
                        <rich:column>
                            <f:facet name="header">财务项目代码</f:facet>
                            <h:outputText value="#{pro.code}"/>
                        </rich:column>
                        <rich:column>
                            <f:facet name="header">财务项目名称</f:facet>
                            <h:outputText value="#{pro.name}"/>
                        </rich:column>
                    </rich:dataTable>
                </div>
            </rich:panel>
        </h:form>
        <f:facet name="footer">
            footer!
        </f:facet>
    </rich:popupPanel>
</ui:composition>
